package lesson17.cars;

public class Car 
{
	protected String model;
	private int maxSpeed = 230;
	protected int currentSpeed;
	protected int currentGear;
	protected int numberOfDoors;
	private int idNumber;
	protected boolean isSportCar;
	Person owner;
	
	protected String type = "Just a car";
	
	protected void changeOwner(Person newOwner)
	{
		this.owner = newOwner;
	}
	protected void startEngine()
	{
		System.out.println("Engine starts!");
	}
	protected void changeGear(int gear)
	{
		if(currentGear > 0)
		{
			this.currentGear = gear;
		}
		
	}
	
	protected void accelerate(double speed)
	{
		if(currentSpeed + speed > maxSpeed)
		{
			currentSpeed = maxSpeed;
		}
		else
		{
			currentSpeed +=speed;
		}
		System.out.println("Now driving with " + currentSpeed);
			
	}
	
	Car(int maxSpeed)
	{
		this.maxSpeed = maxSpeed;
	}
	@Override
	public String toString() {
		return "Car's current gear " + currentGear + "\nCar's current speed: " + currentSpeed;
	}
	
}
